// pages/salesman/areaList/areaList.js
const App = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    dataList:[
      {
        name:"xxxx",
        id:111
      },
      {
        name:"xxxx",
        id:112
      },
      {
        name:"xxxx",
        id:113
      },
      {
        name:"xxxx",
        id:1151
      },
      {
        name:"xxxx",
        id:1122
      },
      {
        name:"xxxx",
        id:1133
      },
      {
        name:"xxxx",
        id:1154
      },
      {
        name:"xxxx",
        id:1154
      },
      {
        name:"xxxx",
        id:1154
      },
      {
        name:"xxxx",
        id:1154
      },
      {
        name:"xxxx",
        id:1154
      },
      {
        name:"xxxx",
        id:1154
      }


    ],
    isLoading: false,
    reLoading: false,
    role:wx.getStorageSync('role')
  },
  /**
    * 页面上拉触底事件的处理函数
  */
  // onReachBottom: function () {
  //     this.ajaxloading = this.selectComponent("#ajax_loading");
  //     if (this.data.current_page >= this.data.last_page){
  //         this.ajaxloading.AjaxLoading(true);
  //         this.ajaxloading.AjaxNoresult(false);
  //         return false;
  //     }
  //     this.getDataList(this.data.current_page + 1);
  //     this.ajaxloading.AjaxLoading(false);
  // },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      // console.log(this.data.role)
      this.getDataList();
      this.setData({
        role: wx.getStorageSync('role')
      })
  },
  // 获取数据列表
  getDataList(page = 1) {
    let _this = this;
    App._get('Area/WxAreaList', {page,userId:wx.getStorageSync('user_id')}, res => {
      // console.log(res)
        _this.setData({
            dataList: res.data
            // current_page: res.data.list.current_page,
            // last_page: res.data.list.last_page,
            // total: res.data.list.total,
        })
    }, false, () => {
        _this.setData({
            isLoading: false,
            reLoading: false,
        })
    })
},
lookList(e){
  let areaId =  e.currentTarget.dataset.areaid;
  wx.navigateTo({
    url: '/pages/salesman/energizeCodeList/energizeCodeList?areaId=' + areaId
  })
},
jump(e){
  let areaId =  e.currentTarget.dataset.areaid;
  wx.navigateTo({
    url: '/pages/salesman/postCode/postCode?areaId=' + areaId
  })
  // console.log(id)
},
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})